package decoder

import (
	jsoniter "github.com/json-iterator/go"
	"time"
	"unsafe"
)

type TimeDecoder struct {

}

func (TimeDecoder) Decode(ptr unsafe.Pointer, iter *jsoniter.Iterator)  {
	val := iter.ReadString()
	format := "2006-01-02 15:04:05"
	theTime, _ := time.Parse(format, val)
	if theTime.Location().String() == "UTC" {
		theTime = theTime.Add(time.Hour * time.Duration(-8))
	}
	*((*time.Time)(ptr)) = theTime
}
